package io.github.wanggit.antrpc.console.web.constants;

public interface WebConstants {

    String ELASTIC_CALL_LOGS_IDX = "call_logs";

    String TOKEN = "Token";

    enum PercentRt {
        rt1(1.0),
        rt5(5.0),
        rt25(25.0),
        rt50(50.0),
        rt75(75.0),
        rt95(95.0),
        rt99(99.0);

        private double percent;

        PercentRt(double percent) {
            this.percent = percent;
        }

        public double getPercent() {
            return percent;
        }

        public static PercentRt instance(double percent) {
            PercentRt[] percentRts = PercentRt.values();
            for (PercentRt percentRt : percentRts) {
                if (percent == percentRt.getPercent()) {
                    return percentRt;
                }
            }
            return null;
        }
    }

    enum TimeRanges {
        m1(1),
        m5(5),
        m15(15),
        m30(30),
        h1(60),
        h2(120),
        h3(180),
        h4(240),
        h5(300),
        h12(720),
        d1(1440),
        d2(2880),
        d3(4320),
        d4(5760),
        d5(7200),
        d6(8640),
        d7(10080);

        TimeRanges(Integer minutes) {
            this.minutes = minutes;
        }

        private Integer minutes;

        public Integer getMinutes() {
            return minutes;
        }
    }
}
